home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Utils Divers 1 / ACME Script Widgets 2.5.1 / Demo Scripts / timing demo < prev    next >
Text File  |  1995-09-19  |  1KB  |  41 lines

  1. -- this is a simple script to compare the performance of the Trim
  2. -- Scripting Addition against performing the same operation with pure AppleScript
  3. -- statements. It requires the Scripting Addition "the ticks" from Jon Pugh's
  4. -- collection of osaxen called "Jon's Commands"
  5.  
  6. set theTimes to {}
  7.  
  8. -- set up test string
  9. set theString to ".......On a clear day you can see forever      "
  10.  
  11. set stTicks to the ticks -- record ticks before beginning
  12.  
  13. set currentChar to length of theString -- strip space/. from end of string
  14. repeat while ((character currentChar of theString = " ") or ┬
  15.     (character currentChar of theString = " ")) ┬
  16.     and (currentChar > 0)
  17.     set currentChar to (currentChar - 1)
  18. end repeat
  19. set theString to characters 1 thru currentChar of theString as text
  20.  
  21. set currentChar to 1 -- strip space/. from start of string
  22. repeat while ((character currentChar of theString = ".") or ┬
  23.     (character currentChar of theString = ".")) ┬
  24.     and (currentChar < length of theString)
  25.     
  26.     set currentChar to (currentChar + 1)
  27. end repeat
  28. set theString to characters currentChar thru -1 of theString as text
  29.  
  30. set theTimes to theTimes & ((the ticks) - stTicks) -- save ending ticks
  31.  
  32. --  reset test string
  33. set theString to ".......On a clear day you can see forever      "
  34. set stTicks to the ticks -- get starting ticks
  35. set theString to trim {".", " "} off theString from both sides
  36.  
  37. set theTimes to theTimes & ((the ticks) - stTicks) -- get ending ticks and return times
  38.  
  39.  
  40. return theTimes
  41.